const { merge } = require("webpack-merge");
const path = require("path");
const common = require("./webpack.common.js");
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = merge(common, {
  entry: path.resolve(__dirname, "./src/entry-client.tsx"),
  output: {
    path: path.resolve(__dirname, "client"),
    filename: "client.js",
    clean: true,
  },
  mode: "development",
  devtool: "eval-source-map",
  devServer: {
    hot: true, // 开启HMR功能，用于开发环境
  },
  plugins: [
    new ReactRefreshWebpackPlugin(),
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, "./public/index.html"),
    }),
  ],
});
